mini.parse();
var refGrid=mini.get("datagrid1");
//得到待办任务传来的值
function SetData(data) {
    data=mini.clone(data);
    console.log(data);
    formId=data.formId;
    cTableName=data.cTableName;
    console.log(formId);
    console.log(cTableName);
    httpRequest();
}
function httpRequest() {
    $.ajax({
        url: ajaxUrl + "/activitiTaskController/StatusQuery.do",
        type: "post",
        dataType: "json",
        traditional: true,
        data: {
            formId: formId,
            cTableName:cTableName
        },
        success: function(data){
            console.log(data);
            console.log(data.processInstanceId);
            processInstanceId=data.processInstanceId;
            console.log(processInstanceId);
            for(var i=0;i<data.postil.length;i++){
                data.postil[0].time=timestampToTime(data.postil[0].time)
            }
            refGrid.setData(data.postil);
            if(processInstanceId){
                fileUrl = ajaxUrl + "/activitiTaskController/getView.do?processInstanceId=" + processInstanceId;
                images = document.getElementById("imgs");
                images.src = fileUrl;
                console.log(images.width);
                console.log(images.height);
            }else{
                mini.alert('暂无流程图');
            }

        },
        error : function(data){

        }
    });
}
//关闭页面
function CloseWindow(action) {
    if (action == "close" && form.isChanged()) {
        if (confirm("数据被修改了，是否先保存？")) {
            return false;
        }
    }
    if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
    else window.close();
}
function onOk() {
    CloseWindow();
}

//时间戳转为日期格式
function timestampToTime(data) {
    var date = new Date(data);
    var  Y = date.getFullYear() + '-';
    var  M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    var  D = (date.getDate()<10 ? '0' +date.getDate() : date.getDate())+ ' ';
    var h = (date.getHours()<10 ? '0' +date.getHours() : date.getHours()) + ':';
    var m = (date.getMinutes()<10 ? '0' +date.getMinutes() : date.getMinutes()) + ':';
    var s = (date.getSeconds()<10 ? '0' +date.getSeconds() : date.getSeconds());
    return Y+M+D+h+m+s;
}